using System;
using System.Collections.Generic;
using System.Text;
using System.Resources;
using System.Collections;
using System.IO;
using Microsoft.Practices.RecipeFramework;
using EnvDTE;
using VSSDKAssist.Assets.Actions.Base;
using VSSDKAssist.Assets.Helpers;
using VSSDKAssist.Recipes.Common.Helpers;

namespace VSSDKAssist.Recipes.Common.Actions
{
	/// <summary>
	/// Action that appends a bitmap entry to a resx file
	/// </summary>
	public class AppendBitmapResxEntryAction : ActionBase
	{
		private ProjectItem resxProjectItem;

		/// <summary>
		/// Gets or sets the RESX project item.
		/// </summary>
		/// <value>The RESX project item.</value>
		[Input(Required = true)]
		public ProjectItem ResxProjectItem
		{
			get { return resxProjectItem; }
			set { resxProjectItem = value; }
		}

		private ProjectItem bitmapProjectItem;

		/// <summary>
		/// Gets or sets the bitmap project item.
		/// </summary>
		/// <value>The bitmap project item.</value>
		[Input(Required = true)]
		public ProjectItem BitmapProjectItem
		{
			get { return bitmapProjectItem; }
			set { bitmapProjectItem = value; }
		}

		private string bitmapResourceId;

		/// <summary>
		/// Gets or sets the bitmap resource id.
		/// </summary>
		/// <value>The bitmap resource id.</value>
		[Input(Required = true)]
		public string BitmapResourceId
		{
			get { return bitmapResourceId; }
			set { bitmapResourceId = value; }
		}

		/// <summary>
		/// Called when [execute].
		/// </summary>
		protected override void OnExecute()
		{
			ResxHelper.AppendBitmapResxEntry(
				this.ResxProjectItem,
				this.BitmapProjectItem,
				this.BitmapResourceId);
		}
	}
}